# -- coding: utf-8 --


def excepter(place):
    def execute_func(func):   # 执行函数
        def execute_except(*args, **kwargs):
            try:
                result = func(*args, **kwargs)
            except Exception as e:
                # 如果出现异常则记录在日志中

                result = None
            return result
        return execute_except
    return execute_func



class DemoTest:

    @excepter('demo12.DemoTest.test_method01')
    def test_method01(self):
        print('测试方法1')

    @excepter('demo12.DemoTest.test_method02')
    def test_method02(self):
        with open('abc') as file:
            file.read()

if __name__ == '__main__':
    dt = DemoTest()
    dt.test_method02()